 <?
 include 'config.inc.php';
 $username = @$_GET['username'];
 $password = @$_GET['password'];
 $cion = @$_GET['cion'];
 include 'member.php';
/*
  取所有的聊天记录
$echo_msg = mysql_query("SELECT * FROM wwk_chat_msg");
*/
/* 从最后开始倒着取20条*/
$sql = "SELECT * FROM wwk_chat_msg order by ID desc limit 30";
$sql = "SELECT * FROM (" . $sql . ") as ch order by ID asc";
$echo_msg = mysql_query($sql);
  while($msg = mysql_fetch_array($echo_msg))
  {   //判断提交进来的用户值是否等于数据库某些值，如果不等于，就是别人说的话
	  if($msg['username'] ==$username){
	     $left = 'right';
	  }else {
	     $left = 'left';
	  }
	 echo '<div class="Item type-'.$left.'">';
     echo '<div class="lay-block">';
     echo '<div class="avatar" style="cursor: pointer;">';
	 echo '<img src="'.$msg['img'].'">';
     echo '</div>';
     echo '<div class="lay-content">';
     echo '<div class="msg-header">';
	  //判断管理员
	  if($admin ==1){    
	 ?>
<a onclick="layer.open({type: 2,title: '对[<?echo $msg['nickname'];?>]操作',shadeClose: true,shade: 0.8,area: ['300px', '180px'],content: '/user_set/index.php?username=<? echo $username;?>&password=<? echo $password;?>&set_nickname=<?echo $msg['nickname'];?>&set_username=<?echo $msg['username'];?>&set_admin=<?echo $msg['type'];?>'});" href="javascript:;">[管理]</a>

<a onclick="layer.open({type: 2,title: '删除[<?echo $msg['username'];?>]的说话信息',shadeClose: true,shade: 0.8,area: ['300px', '180px'],content: '/del_msg/index.php?username=<? echo $username;?>&password=<? echo $password;?>&id=<?echo $msg['id'];?>'});" href="javascript:;">[删除]</a>

   <? } ?>
	  <!-- 艾特标签开始 -->
	 <a href="#" onclick="return  document.getElementById('send_value').value = '@<?echo $msg['nickname'];?>　';">
	 <?
     echo '<h4 style="cursor: pointer;">'.$msg['nickname'].'</h4>';
     ?>
	 </a> <!-- 艾特标签结束 -->
	 <?
	 if($msg['type'] ==1 ||$msg['type'] ==3){ //判断管理员
	   echo '<span class="VipMark type-admin">管理员</span>';
	 }else if($msg['type'] =='2'){
	   echo '<span class="VipMark type-admin">机器人</span>';
	 }else{
	   echo '<span><img src="/images/vip/icon_member'.$msg['vip'].'.gif" alt="'.$msg['vip'].'"></span>';
	 }
     echo '<span class="MsgTime">'.$msg['time'].'</span>';
     echo '</div>';
	 if($msg['type'] ==1 || $msg['type'] ==3 || $msg['type'] ==2){ //判断管理员
     echo '<div class="Bubble type-system" style="color: rgb(255, 255, 255); border-left-color: rgb(81, 105, 222); border-right-color: rgb(171, 71, 188); background: linear-gradient(to right, rgb(171, 71, 188), rgb(81, 105, 222));">';
        }else{
     echo '<div class="Bubble" style="color: rgb(255, 255, 255); background: linear-gradient(to right, rgb(25, 158, 216), rgb(25, 158, 216)); border-left-color: rgb(25, 158, 216); border-right-color: rgb(25, 158, 216);">';
		}
		?>
		<?
     if($msg['type'] ==3){
	?>
	  <p><span style="white-space: pre-wrap; word-break: break-all;"><?echo $msg['msg'];?><a onclick="get_redball_btn();" href="#" ><img src="images/red.png" width="200" height="200" border="0" alt=""></a></span></p>
	<?
	 }else{
      echo '<p><span style="white-space: pre-wrap; word-break: break-all;">'.$msg['msg'].'</span></p>';
	 }
     echo '</div>';
     echo '</div>';
     echo '</div>';
     echo '</div>';
	  }
  
?>
<?
  if($admin ==1){
    echo '<br>';
    echo '<br>';
  }
?>
